<template>
  <!-- 专题推荐 -->
  <div>
    <div class="flRseniority">
      <span>专题推荐</span>
      <span></span>
    </div>
    <div class="flrList flrListC">
      <li v-for="(item,index) in flRseniorityB" :key="index" @click="periodiCon(item,item.OpenId)">
        <div>
          <a>
            <img :src="item.CoverPicture" alt />
          </a>
        </div>
        <p
          style="display: -webkit-box;-webkit-line-clamp: 2;line-clamp: 2;-webkit-box-orient: vertical;"
        >
          <a v-html="item.Title"></a>
        </p>
        <p>{{item.CreatedTime}}</p>
      </li>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      Lmurl: "http://bjlm.bosihw.cn",
      flRseniorityB: []
    };
  },
  methods: {
    // getData(){
    //   axios.get('http://bjlm.bosihw.cn/api/Lm/GetVideoList?pageIndex='+1+'&pageSize='+6).then((res) => {
    //     this.flRseniorityB = res.data.Data.Data
    //     // this.page.total = res.data.Data.Total
    //     // console.log(this.playerOptions.sources[0].src);
    //   }).catch((e) => {
    //     console.log(e);
    //   })
    // },
    getData() {
      // 专家大查房OpenId写死
      this.$httphelper
        .post("/api/LmVideoCourseApi/GetVideoPageList", {
          Sign: "string",
          OpenId: "BD43DCE055C22672",
          Limit: 6,
          Page: 1
        })
        .then(res => {
          this.flRseniorityB = res.data.data||[];
          this.flRseniorityB.forEach(item => {
            item.CreatedTime = item.CreatedTime.substr(0, 10);
          });
        })
        .catch(e => {
          console.log(e);
        });
      // this.httphelper.post('http://bjlm.bosihw.cn/api/Lm/GetNewMediaList',
      // {
      //   mediaType: 0,
      //   ctype: "medmeeting",
      //   contenttype: 98,
      //   PageIndex: 1,
      //   PageSize: 7
      // }).then((res) => {
      //   this.flRseniorityB = res.data.Data.Data
      //   this.flRseniorityB.forEach((item) => {
      //     item.CreatedTime = item.CreatedTime.substr(0,10)
      //   })
      //   this.page.total = res.data.Data.Total
      // })
    },
    periodiCon(item, id) {
      let userName = sessionStorage.getItem("userName");
      // 使用专家大查房数据
      if (userName) {
        this.$uniRouter.push({
          path: "/column/columndetail",
          query: {
            id: id
          }
        });
      } else {
        this.$confirm("请先登录", "提示", {
          customClass: "message-logout",
          confirmButtonText: "确定",
          cancelButtonText: "取消"
        })
          .then(() => {
            this.$uniRouter.push({
              path: "/login"
            });
          })
          .catch(e => {
            console.log(e);
          });
      }

      // 之前美迪康使用数据
      // if(userName){
      //   axios.get('http://bjlm.bosihw.cn/api/Lm/IsUserInfo?mobile='+sessionStorage.getItem('userName')+'&surl='+unescape(id)).then((res) => {
      //     if(res.data.Data == 0){
      //       this.httphelper.post('/api/Lm/UserRegister',
      //       {
      //         strMobile: '',
      //         strPass: sessionStorage.getItem('psw'),
      //         strEmail: sessionStorage.getItem('userName'),
      //         strRealName: "王王王",
      //         strOrg: "心血管",
      //         strurl: id
      //       }).then((res) => {

      //       })
      //     }
      //     else {
      //       window.open(res.data.Data);
      //     }
      //   })
      // }
      // else {
      //   this.$confirm('请先登录', '提示', {
      // customClass: 'message-logout',
      //     confirmButtonText: '确定',
      //     cancelButtonText: '取消',
      //     // type: 'warning'
      //   }).then(() => {
      //     this.$uniRouter.push({
      //       path:'/login',
      //     })
      //   }).catch((e) => {
      //     console.log(e);
      //   });
      // }
    }
  },
  created() {
    this.getData();
  }
};
</script>

<style lang="less" scoped>
.flRseniority {
  /deep/.el-pagination__total {
    display: none;
  }
  /deep/.el-pagination__sizes {
    display: none;
  }
  width: 250px;
  height: 32px;
  margin-left: 19px;
  margin-top: 28px;
  span:nth-child(1) {
    float: left;
    width: 90px;
    height: 32px;
    color: #333;
    font-size: 20px;
    text-align: center;
    line-height: 22px;
    font-family: "SourceHanSansSC-Regular";
    border-bottom: 2px solid #003c80;
    cursor: pointer;
  }
  span:nth-child(2) {
    float: right;
    width: 157px;
    height: 32px;
    color: #333;
    line-height: 22px;
    font-size: 20px;
    text-align: left;
    border-bottom: 2px solid #eeeeee;
    cursor: pointer;
  }
}
.flrListC {
  width: 250px;
  margin-left: 19px;
  margin-top: 10px;
  li {
    list-style: none;
    padding: 14px 0px;
    width: 100%;
    border-bottom: 1px solid #eeeeee;
    cursor: pointer;
    div {
      width: 86px;
      height: 52px;
      float: left;
      img {
        width: 100%;
        height: 100%;
      }
    }
    p {
      display: inline-block;
      color: #333333;
      font-size: 14px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      /* autoprefixer: off */
      -webkit-box-orient: vertical;
      /* autoprefixer: on */
      width: 62%;
      position: relative;
      top: -3px;
      left: 9px;
      line-height: 19px;
      a {
        color: #333;
      }
    }
    p:nth-child(3) {
      font-size: 12px;
      top: 0px;
    }
  }
  li:hover {
    p {
      a {
        color: #003c80;
      }
    }
    p {
      color: #003c80;
    }
  }
}
</style>
<style>
@media screen and (max-width: 1010px) {
  .message-logout {
    width: 80% !important;
  }
}
</style>